<template>
  <ion-page>
    <ion-header>
      <ion-toolbar color="light" class="pub-hearder">
        <ion-buttons slot="start">
          <ion-back-button text=""></ion-back-button>
        </ion-buttons>
        <ion-title>
            {{ title }}
        </ion-title>
      </ion-toolbar>
    </ion-header>
    <ion-content>
        <div class="grad">
            <ion-list  lines="none">
                <ion-item v-for="(item, index) in tkList" :key="index" @click="goDownPage($event, item)">
                    <ion-avatar slot="start" class="avatar">
                        <img class="avatar" :src="item.url">
                    </ion-avatar>
                    <ion-label>
                        <p class="filename">{{ item.title }}</p>
                        <div class="desc">
                            <span>张老师</span> <span>.</span> <span>8小时</span>
                        </div>
                    </ion-label>
                </ion-item>
            </ion-list>
        </div>
    </ion-content>
  </ion-page>
</template>

<script lang="ts">
import { IonPage, IonContent, IonHeader, IonToolbar, IonList, IonItem, IonAvatar, IonLabel, IonButtons, IonBackButton,  IonTitle } from '@ionic/vue';
import { chevronForwardOutline } from 'ionicons/icons';
import { reactive, toRefs, onMounted } from 'vue';
import { useRouter, useRoute } from 'vue-router';
import { PublicService } from '@/utils/public';
const publicService = new PublicService();
export default {
  name: 'login-page',
  components: {
    IonPage, IonContent, IonHeader, IonToolbar, IonList, IonItem, IonAvatar, IonLabel, IonButtons, IonBackButton,  IonTitle
  },
  setup() {
    const router = useRouter();
    const route = useRoute();
    let t: any;
    const state = reactive({
        title: Number(route.query.type) === 1 ? '统考' : '校考',
        fileList: [
            {
                title: '考音乐学院到底要不要跑课',
                size: 10,
                downNum: 2222,
                isMian: 1
            },
            {
                title: '考音乐学院到底要不要跑课',
                size: 10,
                downNum: 2222,
                isMian: 0
            },
            {
                title: '考音乐学院到底要不要跑课',
                size: 10,
                downNum: 2222,
                isMian: 1
            }
        ],
        swiperList: [
            {
                title: '考音乐学院到底要不要跑课',
                url: require('@/assets/images/st.png')
            },
            {
                title: '考音乐学院到底要不要跑课',
                url: require('@/assets/images/st.png')
            },
            {
                title: '考音乐学院到底要不要跑课',
                url: require('@/assets/images/st.png')
            }
        ],
        tkList: [
            {
                title: '考音乐学院到底要不要跑课',
                url: require('@/assets/images/111.jpg')
            },
            {
                title: '考音乐学院到底要不要跑课',
                url: require('@/assets/images/111.jpg')
            },
            {
                title: '考音乐学院到底要不要跑课',
                url: require('@/assets/images/111.jpg')
            },
            {
                title: '考音乐学院到底要不要跑课',
                url: require('@/assets/images/111.jpg')
            },
        ]
    })

    function goDownPage(ev: any, data: any){
        router.push(
            {
                path: '/flie-detail',
                query: {
                    ...data
                }
            }
        );
    }

    return {
      ...toRefs(state),
      chevronForwardOutline,
      goDownPage
    }
  }
}
</script>
<style lang="scss" scoped>
ion-header{
  ion-toolbar{
    --padding-top: 0px;
    --padding-bottom: 0px;
    --padding-start: 0px;
    --padding-end: 0px;
  }
}
ion-content{
    --padding-start: 10px;
    --padding-end: 10px;
    .avatar{
        width: 80px;
        height: 80px;
    }
    ion-item{
        margin-bottom: 20px;
        ion-label{
            margin-top: 0px;
            margin-bottom: 0px;
            height: 100%;
            position: relative;
            .desc{
                position: absolute;
                bottom: 0px;
            }
        }
    }
    .grad{
        margin-top: 20px;
        ion-icon{
            position: relative;
            top: 2px;
            
        }
        .filename{
            font-size: 16px;
            color: #333;
            margin-bottom: 0px;
            margin-top: 0px;
        }
        span{
            font-size: 12px;
            color: #939699;
        }
        label{
            font-size: 12px;
            color: #fff;
            background: #CA3032;
            padding: 3px 5px;
            margin-right: 5px;
            border-radius: 3px;
        }
    }
}
</style>